package com.hospital.tools;

public class JsonResult {
    // 状态码
    private String code;

    // 数据
    private Object data;

    // 信息
    private String msg;

    public JsonResult(String code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public JsonResult() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static JsonResult json_ok(Object data) {
        return new JsonResult("200", data, "success");
    }

    public static JsonResult json_error(String code, String msg) {
        return new JsonResult(code, null, msg);
    }

}
